<template>
  <div class="home-container">
    <div class="hero-section">
      <div class="hero-content">
        <h1 class="hero-title">欢迎来到Vue.js应用</h1>
        <p class="hero-subtitle">这是一个现代化的前端框架示例</p>
        <div class="hero-actions">
          <button class="btn primary-btn" @click="goToAbout">了解更多</button>
          <button class="btn secondary-btn" @click="scrollToFeatures">查看功能</button>
        </div>
      </div>
      <div class="hero-image">
        <img alt="Vue logo" src="/logo.png" class="logo-image">
      </div>
    </div>
    
    <div class="features-section" ref="featuresSection">
      <h2 class="section-title">核心功能</h2>
      <div class="features-grid">
        <div class="feature-card" v-for="feature in features" :key="feature.title">
          <div class="feature-icon">{{ feature.icon }}</div>
          <h3 class="feature-title">{{ feature.title }}</h3>
          <p class="feature-description">{{ feature.description }}</p>
        </div>
      </div>
    </div>
    
    <HelloWorld msg="Vue.js开发入门"/>
  </div>
</template>

<script>
// @ is an alias to /src
import HelloWorld from '@/components/HelloWorld.vue'

export default {
  name: 'HomeView',
  components: {
    HelloWorld
  },
  data() {
    return {
      features: [
        {
          icon: '⚡',
          title: '快速开发',
          description: '基于Vue CLI构建工具，提供高效的开发体验'
        },
        {
          icon: '📱',
          title: '响应式设计',
          description: '适配各种设备屏幕，提供一致的用户体验'
        },
        {
          icon: '⚙️',
          title: '组件化架构',
          description: '模块化开发，提高代码复用性和可维护性'
        },
        {
          icon: '🚀',
          title: '高性能',
          description: '优化的渲染机制，确保流畅的用户交互'
        }
      ]
    }
  },
  methods: {
    goToAbout() {
      this.$router.push('/about')
    },
    scrollToFeatures() {
      this.$refs.featuresSection.scrollIntoView({ behavior: 'smooth' })
    }
  }
}
</script>

<style scoped lang="scss">
.home-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  background: linear-gradient(135deg, #e0f7fa 0%, #f5f5f5 100%);
  min-height: calc(100vh - 140px);
  border-radius: 10px;
}

.hero-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 60px 0;
  gap: 40px;
  
  @media (max-width: 768px) {
    flex-direction: column;
    text-align: center;
  }
}

.hero-content {
  flex: 1;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: #2c3e50;
  
  @media (max-width: 768px) {
    font-size: 2rem;
  }
}

.hero-subtitle {
  font-size: 1.2rem;
  color: #7f8c8d;
  margin-bottom: 30px;
}

.hero-actions {
  display: flex;
  gap: 15px;
  
  @media (max-width: 768px) {
    justify-content: center;
  }
}

.btn {
  padding: 12px 24px;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
}

.primary-btn {
  background-color: #42b983;
  color: white;
  
  &:hover {
    background-color: #359c6d;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  }
}

.secondary-btn {
  background-color: transparent;
  color: #42b983;
  border: 2px solid #42b983;
  
  &:hover {
    background-color: #f0f9f6;
    transform: translateY(-2px);
  }
}

.hero-image {
  flex: 1;
  display: flex;
  justify-content: center;
}

.logo-image {
  width: 300px;
  height: 300px;
  object-fit: contain;
  
  @media (max-width: 768px) {
    width: 200px;
    height: 200px;
  }
}

.features-section {
  padding: 80px 0;
  text-align: center;
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 50px;
  color: #2c3e50;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
  margin-bottom: 60px;
}

.feature-card {
  padding: 30px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  
  &:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
  }
}

.feature-icon {
  font-size: 2.5rem;
  margin-bottom: 20px;
}

.feature-title {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 15px;
  color: #2c3e50;
}

.feature-description {
  color: #7f8c8d;
  line-height: 1.6;
}
</style>